import sys
from celery import Celery

# 为celery使⽤django配置⽂件进⾏设置
import os

if not os.getenv('DJANGO_SETTINGS_MODULE'):
    os.environ['DJANGO_SETTINGS_MODULE'] = 'meiduo_mall.settings.dev'


celery_app = Celery("meiduo")  # 创建异步celery实例对象

# 加载配置
celery_app.config_from_object('celery_tasks.config')

# 添加异步任务
celery_app.autodiscover_tasks(['celery_tasks.sms', "celery_app.email"])
# from celery_tasks.sms.tasks import send_sms_code
# celery_app.register_task(send_sms_code)
# print(sys.path)
